
const Koa = require('koa');
const app = new Koa();
require('./middleware').init(app);

app.use(ctx => {
    if (ctx.path.startsWith('/login/init') && ctx.method.toUpperCase() === "GET") {
        console.log("ctx.session", ctx.session);
        ctx.body = JSON.stringify(ctx.session.userInfo);
        return;
    }
    console.log(ctx.path, " 没有走代理");
    // 没有走代理
    // ctx.status = 302;
    // ctx.redirect("/cas/login?service=http%3A%2F%2Flocalhost%3A3000%2Finfoplus%2Fform%2FXNYQSB%2Fstart")
})

let port = 3000;
app.listen(port, () => {
    console.log(`${port}端口启动成功`)
}).on('error', console.error).timeout = 60*1000
